package com.sjzd.discoveryserviceprovider.service01;

import com.sjzd.discoveryserviceprovider.ProviderUser;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Provider;

/**
 * @author ZFQ
 * @date 2022/2/13
 */
@SpringBootApplication
@RestController
@RequestMapping("/service")
public class ServiceController01 {

    public static void main(String[] args) {
        SpringApplication.run(ServiceController01.class, args);
    }

    @RequestMapping("/hello")
    public String hello() {
        return "hello, i am service01";
    }

    @RequestMapping("/error")
    public String error() {
        return String.valueOf(1 / 0);
    }

    @RequestMapping("/echo")
    public String echo(String command) {
        return command;
    }

    @RequestMapping("/user")
    public String echo(@RequestBody ProviderUser user) {
        return user.toString();
    }
}
